<template>
	<div class="flex justify-center align-center flex-direction flex-no-wrap"
		v-loading.fullscreen.lock="fullscreenLoading" style="width: 100%;height: 100%">
		<div class="flex justify-center align-center flex-no-wrap padding"
			style="border: 1px solid #ddd; border-radius: 15px;">
			<el-image style="width: 80px; height: 80px"
				:src="companyICO" fit="scale-down">
			</el-image>
		</div>
		<div class="margin-top-xs">美莱文化</div>
		<div class="margin-bottom">v{{verInfo.version}}</div>
		<el-button class="" type="primary" size="mini" @click.native="downloadApk">下载</el-button>
	</div>
</template>

<script>
	import {
		getVerInfo
	} from "@/api/app/extra.js";
	import companyICO from "@/assets/images/company_ico.jpg";
	import {
		Message
	} from 'element-ui';
	import {
		cloneDeep
	} from 'lodash';
	export default {
		beforeCreate() {},
		beforeDestroy() {},
		// beforeRouteLeave(to, from, next) {
		// 	this.$destroy();
		// 	next();
		// },
		activated() {},
		deactivated() {},
		data() {
			return {
				companyICO,
				fullscreenLoading: false,
				verInfo: {
					version: '',
					download_url: ''
				}
			}
		},
		created() {
		},
		mounted() {
			this.getVer()
		},
		methods: {
			getVer() {
				const that = this;
				that.fullscreenLoading = true;
				return getVerInfo()
					.then(({
						data
					}) => {
						that.verInfo = data
						that.fullscreenLoading = false;
					})
			},
			downloadApk(){
				if(this.verInfo.download_url) window.open(this.verInfo.download_url);
			}
		}
	};
</script>

<style>
</style>
